<!DOCTYPE html>
<!-- saved from url=(0052)http://getbootstrap.com/docs/4.0/examples/dashboard/ -->
<html lang="en">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<meta name="description" content="">
		<meta name="author" content="">
		<title>软件园商城</title>
		<!-- Bootstrap core CSS -->
		<link href="css/bootstrap.min.css" rel="stylesheet"  th:href="@{/css/bootstrap.min.css}">
		<!-- Custom styles for this template -->
		<link href="css/dashboard.css" rel="stylesheet">
		<style type="text/css">
			/* Chart.js */
			@-webkit-keyframes chartjs-render-animation {
				from {
					opacity: 0.99
				}
				to {
					opacity: 1
				}
			}
			
			@keyframes chartjs-render-animation {
				from {
					opacity: 0.99
				}
				to {
					opacity: 1
				}
			}
			
			.chartjs-render-monitor {
				-webkit-animation: chartjs-render-animation 0.001s;
				animation: chartjs-render-animation 0.001s;
			}
		</style>
	</head>

	<body>
	<!--顶部导航-->
	<div th:replace="~{topleft::topnav}"></div>

		<div class="container-fluid">
			<div class="row">
				<!--左部导航-->
				<div th:replace="~{topleft::#sidebarMenu(lurl='leftuser')}"></div>
				<main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
					<h2>后台主页</h2>
					<h2><a class="btn btn-success btn-sm" href="#" th:href="@{/addUser}">添加用户</a></h2>
					<!--查询表单-->
					<form action="#"th:action="@{/getUserList}" method="get">
						<input type="text"name="name" placeholder="姓名"th:value="${name}">
						<select name="sex">
							<option value="">性别</option>
							<option value="男"th:selected="${sex=='男'}">男</option>
							<option value="女"th:selected="${sex=='女'}">女</option>
						</select>
						<input type="text" name="address" placeholder="地址"th:value="${address}">
						<button type="sumbit" class="btn btn-info btn-sm">搜索</button>
					</form>
					<div class="table-responsive">
						<table class="table table-striped table-sm">

							<thead>
							<tr>
								<th>编号</th>
								<th>姓名</th>
								<th>性别</th>
								<th>年龄</th>
								<th>生日</th>
								<th>电话</th>
								<th>地址</th>
								<th>操作</th>
							</tr>
							</thead>
							<tbody>
							<tr th:each="user:${pageInfo.list}">
								<td th:text="${user.id}"></td>
								<td th:text="${user.name}"></td>
								<td th:text="${user.sex}"></td>
								<td th:text="${user.age}"></td>
								<td th:text="${#dates.format(user.birthday,'yyyy-MM-dd')}"></td>
								<td th:text="${user.phone}"></td>
								<td th:text="${user.address}"></td>
								<td class="center">
									<a class="btn btn-success btn-sm" href="#" th:href="@{/user/}+${user.id}">查看</a>
									<a class="btn btn-info btn-sm" href="#" th:href="@{/toUpdateUser/}+${user.id}">修改</a>
									<a class="btn btn-danger btn-sm" href="#" th:href="@{/delUser/}+${user.id}">删去</a>
								</td>
							</tr>
							</tbody>
						</table>
						<!-- 分页导航 -->
						<!-- 分页导航 -->
						<div>
							<!--如果有上一页-->
							<span th:if="${pageInfo.hasPreviousPage}">
            <a th:href="@{/getUserList(pageNum=1, name=${name}, sex=${sex}, address=${address})}">首页</a>
            <a th:href="@{/getUserList(pageNum=${pageInfo.prePage}, name=${name}, sex=${sex}, address=${address})}">上一页</a>
        </span>
							<span th:each="num : ${pageInfo.navigatepageNums}">
            <a th:if="${num != pageInfo.pageNum}"
			   th:href="@{/getUserList(pageNum=${num}, name=${name}, sex=${sex}, address=${address})}"
			   th:text="${num}">
            </a>
            <span th:unless="${num != pageInfo.pageNum}" th:text="${num}" style="color:red;"></span>
        </span>
							<!--如果有下一页-->
							<span th:if="${pageInfo.hasNextPage}">
            <a th:href="@{/getUserList(pageNum=${pageInfo.nextPage}, name=${name}, sex=${sex}, address=${address})}">下一页</a>
            <a th:href="@{/getUserList(pageNum=${pageInfo.pages}, name=${name}, sex=${sex}, address=${address})}">尾页</a>
        </span>
						</div>
						<p style="color: red" th:text="${msg==''?'': msg}"></p>
					</div>
				</main>
			</div>
		</div>

		<!-- Bootstrap core JavaScript
    ================================================== -->
		<!-- Placed at the end of the document so the pages load faster -->
		<script type="text/javascript" src="js/jquery-3.2.1.slim.min.js"></script>
		<script type="text/javascript" src="js/popper.min.js"></script>
		<script type="text/javascript" src="js/bootstrap.min.js"></script>

		<!-- Icons -->
		<script type="text/javascript" src="js/feather.min.js"></script>
		<script>
			feather.replace()
		</script>

		<!-- Graphs -->
		<script type="text/javascript" src="js/Chart.min.js"></script>
		<script>
			var ctx = document.getElementById("myChart");
			var myChart = new Chart(ctx, {
				type: 'line',
				data: {
					labels: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
					datasets: [{
						data: [15339, 21345, 18483, 24003, 23489, 24092, 12034],
						lineTension: 0,
						backgroundColor: 'transparent',
						borderColor: '#007bff',
						borderWidth: 4,
						pointBackgroundColor: '#007bff'
					}]
				},
				options: {
					scales: {
						yAxes: [{
							ticks: {
								beginAtZero: false
							}
						}]
					},
					legend: {
						display: false,
					}
				}
			});
		</script>

	</body>

</html>